
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main9{

    private static Scanner in;
    
    public static void main(String[] args) {
        in = new Scanner(System.in);
        List<Student> studentlist=new ArrayList<>();
        System.out.println("201621123016-郑玉波");
        for (int i = 0; i < 3; i++) {
            studentlist.add(new Student(in.nextLong(), in.next(), in.nextInt(), Gender.MAN, in.nextBoolean()));
        }
        studentlist.add(null);
        for (int i = 0; i < 3; i++) {
            studentlist.add(new Student(in.nextLong(), in.next(), in.nextInt(), Gender.WOMEN, in.nextBoolean()));
        }
       
        List<Student> list=search(studentlist,10L,"zyb",12,Gender.MAN,true);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
   
    public static List<Student> search(List<Student> stuList,Long id, String name, int age, Gender gender, boolean joinsACM){
        List<Student> list=new ArrayList<>();
        int flag=1;
        for (int i = 0; i < stuList.size(); i++) {
            if(stuList.get(i).getId()<=id)
                flag=0;
            if(stuList.get(i).getName().compareTo(name)!=0)
                flag=0;
            if (stuList.get(i).getAge()!=age) 
                flag=0;
            if (stuList.get(i).getGender()!=gender) 
                flag=0;
            if (stuList.get(i).isJoinsACM()!=joinsACM)    
                flag=0;
            if (flag==1) 
                list.add(stuList.get(i));
            flag=1;
        }
        return list;
       
    }
}

enum Gender {
    MAN,WOMEN
}


class Student{
    private Long id;
    private String name;
    private int age;
    private Gender gender;
    private boolean joinsACM;
   
    public Student(Long id, String name, int age, Gender gender, boolean joinsACM) {
        super();
        this.id = id;
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.joinsACM = joinsACM;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public boolean isJoinsACM() {
        return joinsACM;
    }

    public void setJoinsACM(boolean joinsACM) {
        this.joinsACM = joinsACM;
    }
    public String toString(){
        return "Student [ id = "+id+", name = "+name+", age = "+age+", gender = "+gender+", joinsACM = "+joinsACM+"]";
    }
   
}